﻿using System.Xml.Linq;

namespace Grinder.Fb2
{
    public sealed class PublishInfo
    {
        #region Public Properties
        public string BookName { get; set; }
        public string Publisher { get; set; }
        public string City { get; set; }
        public string Year { get; set; }
        #endregion

        public PublishInfo() {}

        public PublishInfo(XContainer element)
        {
            var el = element.Element(Constants.Xmlns + "book-name");
            BookName = (el == null) ? "" : el.Value;

            el = element.Element(Constants.Xmlns + "publisher");
            Publisher = (el == null) ? "" : el.Value;

            el = element.Element(Constants.Xmlns + "city");
            City = (el == null) ? "" : el.Value;

            el = element.Element(Constants.Xmlns + "year");
            Year = (el == null) ? "" : el.Value;
        }
    }
}
